package main

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/canvas"
	"image/color"
	"time"
)

/*
 画布，新增一个画布，可以填充颜色等信息
*/

func main() {
	myApp := app.New()

	w := myApp.NewWindow("Rectangle")

	text := canvas.NewText("Hi", color.Black)
	callback := func(p fyne.Position) {
		text.Move(p)
		canvas.Refresh(text)
	}
	start := fyne.NewPos(10, 10)
	end := fyne.NewPos(90, 10)
	anim := canvas.NewPositionAnimation(start, end,
		time.Second, callback)
	anim.Start()

	w.SetPadded(false)

	w.Resize(fyne.NewSize(150, 100))

	w.ShowAndRun()
}
